require 'java'
require 'singleton'

module JavaSql
  include_package 'java.sql'
end

class DatabaseInterface
  include Singleton
  
  def initialize()
    include_class("java.lang.Class")
    Java::JavaClass.for_name("org.apache.derby.jdbc.EmbeddedDriver")
  end
  
  def getDbConnection(dbname)
    connection = JavaSql::DriverManager.getConnection("jdbc:derby:#{dbname};","","")
    return connection
  end
  
  def closeConnection(connection)
    connection.close()
  end
  
  
  
end